package com.duobaoyu.dby.supply.biz.converter;

import com.duobaoyu.dby.channel.boundary.bean.auth.param.BatchRefreshTokenParam;
import com.duobaoyu.dby.channel.boundary.bean.auth.result.AuthTokenResult;
import com.duobaoyu.dby.common.core.constant.CommonConstants;
import com.duobaoyu.dby.common.core.convert.bean.ReferenceMapper;
import com.duobaoyu.dby.supply.biz.client.boundary.auth.bean.bo.AuthTokenBO;
import com.duobaoyu.dby.supply.biz.client.boundary.auth.bean.dto.BatchRefreshTokenDTO;
import org.mapstruct.Builder;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * @author liyang
 * @version 1.0.0
 * @ClassName ChannelAccessTokenConverter
 * @createTime 15:38:00 2023/10/10
 */
@Mapper(uses = ReferenceMapper.class, builder = @Builder(disableBuilder = true), componentModel = CommonConstants.COMPONENT_MODEL)
public interface ChannelAccessTokenConverter {

    /**
     * to BatchRefreshTokenParam
     * @param batchRefreshToken
     * @return
     */
    @Mapping(source ="authToken",target = "authTokenParam")
    BatchRefreshTokenParam toBatchRefreshTokenParam(BatchRefreshTokenDTO batchRefreshToken);

    /**
     * to AuthTokenBO List
     * @param authTokenResults
     * @return
     */
    List<AuthTokenBO> toAuthTokenList(List<AuthTokenResult> authTokenResults);

    /**
     * to AuthTokenBO
     * @param authTokenResult
     * @return
     */
    AuthTokenBO toAuthToken(AuthTokenResult authTokenResult);
}
